package com.easytopit.demo.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import com.easytopit.demo.domain.Cinema;

/**
 * @author YWQ
 *
 */
public interface CinemaMapper {

	/**
	 * 录入影院
	 * @param cinema
	 * @return
	 */
	@Insert({
		"INSERT INTO cinema(name,address,phone,features,quantity,hallName,score)"
			+ " values(#{name },#{address},#{phone},#{features},#{quantity},#{hallName},#{score})"
	})
	@Options(useGeneratedKeys=true,keyProperty="id")
	public int insert(Cinema cinema);
	
	/**
	 * 修改影院信息
	 * @param name
	 * @param address
	 * @param phone
	 * @param features
	 * @param quantity
	 * @param hallName
	 * @param score
	 * @return
	 */
	@Update({
		"update cinema set name=#{name},address = #{address},phone = #{phone},features = #{features},"
		+ "quantity = #{quantity},hallName = #{hallName},score = #{score} where id=#{id}"
	})
	public int update(@Param("name")String name,@Param("address")String address,
			@Param("phone")String phone,@Param("features")String features,@Param("quantity")Integer quantity,
			@Param("hallName")String hallName,@Param("score")Double score);
}